var express = require("express");
var router = express.Router();

//引入mongoose
let mongoose = require("mongoose");

/* GET users listing. */
// router.get("/", function (req, res, next) {
//   res.send("respond with a resource");
// });

router.get("/", async function (req, res) {
  //根据账号查询用户数据
  let re = await mongoose.model("messageModel").find();
  console.log("数据库数据", re);
  // res.statusCode = 200;
  // res.json({
  //   message: re,
  // });
  res.send({
    code: 200,
    message: re,
  });
});

module.exports = router;
